import request from "@/utils/request";

const DEPT_BASE_URL = "/api/v1.0/PlatformPromotionSession";

const PromotionAPI = {
  /**
   * 促销列表
   *
   * @param queryParams 查询参数（可选）
   * @returns 部门树形表格数据
   */
  getList(queryParams?: any) {
    return request<any, any[]>({
      url: `${DEPT_BASE_URL}/QueryPromotionSessions`,
      method: "post",
      data: queryParams,
    });
  },
  /**
   * 添加商品
   *
   * @param data 添加参数
   * @returns 部门树形表格数据
   */
  add(data?: any) {
    return request<any, any[]>({
      url: `${DEPT_BASE_URL}/AddPromotionSession`,
      method: "post",
      data: data,
    });
  },
  /**
   * 添加商品图片
   * GoodsId
   * StoreId
   * GoodsPics
   */
  addImage(data?: any) {
    return request<any, any[]>({
      url: `${DEPT_BASE_URL}/AddGoodsInfoImages`,
      method: "post",
      data: data,
    });
  },
  /**
   * 编辑商品
   *
   */
  update(data?: any) {
    return request<any, any[]>({
      url: `${DEPT_BASE_URL}/UpdatePromotionSession`,
      method: "post",
      data: data,
    });
  },
  /**
   * 编辑商品
   *
   */
  addGoods(data?: any) {
    return request<any, any[]>({
      url: `${DEPT_BASE_URL}/AddPromotionSessionGoods`,
      method: "post",
      data: data,
    });
  },
  /**
   * 商品详情
   *
   */
  detailInfo(queryParams?: any) {
    return request<any, any[]>({
      url: `${DEPT_BASE_URL}/GetPromotionSessionById`,
      method: "get",
      params: queryParams,
    });
  },

  /**
   * 删除
   *
   * @param queryParams 查询参数（可选）
   * @returns 部门树形表格数据
   */
  deleteByIds(queryParams?: any) {
    return request<any, any[]>({
      url: `${DEPT_BASE_URL}/DeletePromotionSession`,
      method: "post",
      data: queryParams,
    });
  },
};

export default PromotionAPI;
/**
 * 用户分页查询对象
 */
export interface GoodsPageQuery extends PageQuery {
  /** 搜索关键字 */
  keywords?: string;

  /** 用户状态 */
  status?: number;

  /** 部门ID */
  deptId?: string;

  /** 开始时间 */
  createTime?: [string, string];
}
